﻿// -----------------------------------------------------------------------
// <copyright file="Action.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Ex04.Menus.Interfaces
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class Action : MenuItem
    {
        private IPerformTheAction m_ActionToPerform;

        /// <summary>
        /// Action function that performs the given action
        /// </summary>
        /// <param name="i_NameAction">The string represents the action name</param>
        /// <param name="i_actionToPerform">The actual action</param>
        public Action(string i_NameAction, IPerformTheAction i_actionToPerform) : base(i_NameAction)
        {
            this.m_ActionToPerform = i_actionToPerform;
        }

        internal override void DoSomething()
        {
            Console.Clear();
            this.m_ActionToPerform.Action();
        }
    }
}
